#ifndef _KEGSCALE_MK2_H_
#define _KEGSCALE_MK2_H_

#define uint32_t unsigned long
#define uint16_t unsigned short
#define uint8_t unsigned char

#define LCD_WIDTH_ADDR 0
#define LCD_HEIGHT_ADDR 1
#define NUM_KEGS_ADDR 2
#define TIMEOUT_ADDR 3
#define KEGINFO_ADDR 4

#define EEPROM_KEGINFO_SIZE 7
#define KEGINFO_KEG_FULL_OFFSET    0
#define KEGINFO_HZ_PER_PINT_OFFSET 3
#define KEGINFO_MAX_PINTS_OFFSET   6

#define KEG_NAME_ADDR 60

#define CALC_KEGINFO_OFFSET(keg_num) KEGINFO_ADDR + EEPROM_KEGINFO_SIZE * keg_num;

struct keginfo_s {
    uint32_t keg_empty;
    uint32_t keg_full;
    uint32_t hz_per_pint;
    uint8_t  max_pints;
};

extern rom char* version;
extern uint8_t last_ccp_8;
extern uint8_t last_ccp_16;
extern uint8_t last_ccp_24;
extern uint8_t tmr1_24;
extern uint8_t current_ccp_24;
extern uint8_t cur_keg;

extern volatile bit start_ccp_trigger;
extern volatile bit button_trigger;
extern volatile bit long_button_trigger;

extern uint32_t get_ccp_frequency();
extern uint32_t get_keg_level(uint8_t keg_num);
#endif
